package com.ddwanglife.annotation;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class CreateOperateProxy {
    OperateHandler oh = new OperateHandler();
    public Object getProxy(){
       return Proxy.newProxyInstance(this.getClass().getClassLoader(),new Class[]{IOService.class},
               new InvocationHandler(){
                   @Override
                   public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                        oh.operateDisk(method.getName());
                       return null;
                   }
               });
    }
}
